﻿using Coldairarrow.Business.Base_leasesystem_merchantpaychannel;
using Coldairarrow.Entity.Base_leasesystem_merchantpaychannel;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using NSwag.Annotations;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coldairarrow.Api.Controllers.Base_leasesystem_merchantpaychannel
{
    /// <summary>
    /// 客户代发通道配置
    /// </summary>
    [Route("/Base_leasesystem_merchantpaychannel/[controller]/[action]")]
    [OpenApiTag("客户代发通道配置")]
    public class leasesystem_merchantpaychannelController : BaseApiController
    {
        #region DI

        public leasesystem_merchantpaychannelController(Ileasesystem_merchantpaychannelBusiness leasesystem_merchantpaychannelBus)
        {
            _leasesystem_merchantpaychannelBus = leasesystem_merchantpaychannelBus;
        }

        Ileasesystem_merchantpaychannelBusiness _leasesystem_merchantpaychannelBus { get; }

        #endregion

        #region 获取

        [HttpPost]
        public async Task<PageResult<leasesystem_merchantpaychannel>> GetDataList(PageInput<ConditionDTO> input)
        {
            return await _leasesystem_merchantpaychannelBus.GetDataListAsync(input);
        }

        [HttpPost]
        public async Task<object> GetDataListOver(PageInput<ConditionDTO> input)
        {
            return await _leasesystem_merchantpaychannelBus.GetDataListOver(input);
        }

        [HttpPost]
        public async Task<leasesystem_merchantpaychannel> GetTheData(IdInputDTO input)
        {
            return await _leasesystem_merchantpaychannelBus.GetTheDataAsync(input.id);
        }

        /// <summary>
        /// 根据客户id  服务商id  状态  查询通道
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public object GetDataByM_SID(List<string> Ids)
        {
            return _leasesystem_merchantpaychannelBus.GetDataByM_SID(Ids);
        }
        #endregion

        #region 提交

        [HttpPost]
        public async Task SaveData(leasesystem_merchantpaychannel data)
        {
            if (data.Id.IsNullOrEmpty())
            {
                InitEntity(data);

                await _leasesystem_merchantpaychannelBus.AddDataAsync(data);
            }
            else
            {
                await _leasesystem_merchantpaychannelBus.UpdateDataAsync(data);
            }
        }

        [HttpPost]
        [ApiPermission("merchantpaychannel.Delete")]
        public async Task DeleteData(List<string> ids)
        {
            await _leasesystem_merchantpaychannelBus.DeleteDataAsync(ids);
        }

        #endregion
    }
}